<template>
  <el-breadcrumb separator="/" class="bread">
    <!--<el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>-->
    <el-breadcrumb-item
      v-for="item in navs"
      :key="item.path"
      :to="{ path: item.path }"
      >{{ item.meta.title }}</el-breadcrumb-item
    >
  </el-breadcrumb>
</template>

<script>
export default {
  computed: {
    navs() {
      console.log("路由信息", this.$route.matched); //包含了当前的路由以及上级路由信息
      let routes = this.$route.matched;
      //处理第一个路由信息
      routes[0].path='/';
      routes[0].meta.title='首页';
      return routes;
    },
  },
  created() {
    console.log(this.$route.matched);
  },
};
</script>


<style lang="less" scoped>
.bread {
  margin-bottom: 10px;
}
</style>
